import React from 'react';
import WaterShow from './waterShow'

export default  class my extends React.Component{
    constructor(props){
        super(props)
        this.handleTemplate=this.handleTemplate.bind(this)
        this.state={num:15}
    }
    componentWillMount() {
    }

    handleTemplate(type,num){
        console.log(type+'is change：'+num)
        if(type==='正常温度'){
            this.setState({
                num:num
            })
        }else{
            this.setState({
                num:num+37
            })
        }
    }
    render() {
        return (
            <div>
                <WaterShow handleTem={this.handleTemplate} type={'正常温度'}
                           num={this.state.num} />
                <WaterShow handleTem={this.handleTemplate} type={'花式温度'}
                           num={this.state.num-37} />
                           <div>{this.state.num>=100?'水会烧开':'水不会烧开'}</div>
            </div>
        )
    }
}
